package cn.lin.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

/**
 * @author cn.Lin
 * @create 2024-12-03-10:13
 */
@Configuration
@EnableWebMvc
@ComponentScan("cn.lin.controller")
public class MySpringMvcConfig implements WebMvcConfigurer {

    /**
     * 全局跨域请求
     */
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        WebMvcConfigurer.super.addResourceHandlers(registry);
    }

}
